<template>
  <div>
    <!-- eslint规范 -->
    <button @click="btnClick">点击调用接口</button>
    <button @click="btnClick2">api测试使用</button>
  </div>
</template>
<script>
import axios from 'axios'
import { sysLogin } from '@/api/test'
export default {
  data() {
    return {
      token: ''
    }
  },

  methods: {
    async btnClick() {
      const res = await axios({
        url: 'http://geek.itheima.net/v1_0/channels'
        // withCredentials: true // 默认跨域cookie不参与接口请求，同源还是参与的
      })
    },
    async btnClick2() {
      const res = await sysLogin()
      this.token = res.data.data
    }
  }
}
</script>
<style></style>
>
